package com.guoyw.dubbo.bootclient.controller;

import com.guoyw.dubbo.member.entity.User;
import com.guoyw.dubbo.member.service.UserService;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * author: guoyw
 * create: 2020-09-18 19:17
 **/

@RestController
public class BootClientController{
  
  @Reference
  UserService userService;
  
  @GetMapping("/add")
  @GlobalTransactional
  public int confirmOrder(){
    User user = new User();
    user.setId(9);
    user.setSex("男");
    user.setSex2("男");
    user.setName("guoyw");
    user.setAge(18);
  
    int aa = userService.insterUser(user);
    
    System.out.println(aa);
    
//    int bb = 12/0;
    
    return aa;
  }
  
}
